import { createSlice } from "@reduxjs/toolkit";

export const user = createSlice({
  name: "user",
  initialState: {
    token: "",
    user: {},
  },
  reducers: {
    setInfor(state, { payload }) {
      state.user = payload.token;
      state.token = payload.user;
    },
  },
});

// Action creators are generated for each case reducer function
export const { setInfor } = user.actions;

export default user.reducer;
